package com.appkubes.fintech.restful.application.system.controller;

import com.appkubes.fintech.common.response.Response;
import com.appkubes.fintech.restful.application.system.entity.dto.RentPeriodSettingDTO;
import com.appkubes.fintech.restful.application.system.entity.vo.RentPeriodSettingVO;
import com.appkubes.fintech.restful.application.system.service.SettingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @Author: Rongjie
 * @Date: 2020/1/5 20:17
 * @Description:
 */


@Slf4j
@Api(tags = "系统配置")
@RestController
@RequestMapping("/system/")
public class SystemController {
    @Resource
    SettingService settingService;


    @ApiOperation("获取租期设置")
    @GetMapping("/getPeriodSetting")
    public Response<RentPeriodSettingDTO> getPeriodSetting(@Valid RentPeriodSettingVO rentPeriodSettingVO, BindingResult bindingResult) {
        if (bindingResult.hasErrors()) {
            return Response.fail("参数检查失败");
        }

        RentPeriodSettingDTO rentPeriodSettingDTO = settingService.getPeriodSetting(rentPeriodSettingVO);
        return Response.success(rentPeriodSettingDTO);
    }

}
